home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / BAS / Internet / Builder / ind2.htt < prev    next >
Text File  |  2001-04-22  |  31KB  |  947 lines

  1.  
  2. <!--
  3. Joust Outliner Version 2.5.4
  4. (c) Copyright 1996-2001, MITEM (Europe) Ltd. All rights reserved.
  5. This code may be freely copied and distributed provided that it is accompanied by this 
  6. header.  For full details of the Joust license, as well as documentation and help, go 
  7. to http://www.ivanpeters.com/.
  8.  
  9. Do not modify anything between here and the "End of Joust" marker unless you know what you
  10. are doing.  
  11. -->
  12. <script language="JavaScript">
  13. <!--
  14. function getDHTMLObj(docName, objName) {
  15.     if     (theBrowser.hasW3CDOM) {
  16.         return eval(docName + '.getElementById("' + objName + '").style');
  17.     } else {
  18.         return eval(docName + theBrowser.DHTMLRange + '.' + objName + theBrowser.DHTMLStyleObj);
  19.     }
  20. }
  21. function getDHTMLObjTop(theObj) {return (theBrowser.code == "MSIE") ? theObj.pixelTop : theObj.top;}
  22. function getDHTMLObjHeight(docName, objName) {
  23.     if     (theBrowser.hasW3CDOM) {
  24.         return parseInt(eval(docName + '.getElementById("' + objName + '").offsetHeight'),10);
  25.     } else {
  26.         return eval(docName + theBrowser.DHTMLRange + '.' + objName + theBrowser.DHTMLDivHeight);
  27.     }
  28. }
  29. function getDHTMLImg(docName, objName, imgName) {
  30.     if     (document.layers) {
  31.         return getDHTMLObj(docName, objName).document.images[imgName];
  32.     } else {
  33.         return eval(docName + '.images.' + imgName);
  34.     }
  35. }
  36. function simpleArray() {this.item = 0;}
  37. function imgStoreItem(n, s, w, h) {
  38.     this.name = n;
  39.     this.src = s;
  40.     this.obj = null;
  41.     this.w = w;
  42.     this.h = h;
  43.     if ((theBrowser.canCache) && (s)) {
  44.         this.obj = new Image(w, h);
  45.         this.obj.src = s;
  46.     }
  47. }
  48. function imgStoreObject() {
  49.     this.count = -1;
  50.     this.img = new imgStoreItem;
  51.     this.find = imgStoreFind;
  52.     this.add = imgStoreAdd;
  53.     this.getSrc = imgStoreGetSrc;
  54.     this.getTag = imgStoreGetTag;
  55. }
  56. function imgStoreFind(theName) {
  57.     var foundItem = -1;
  58.     for (var i = 0; i <= this.count; i++) {if (this.img[i].name == theName) {foundItem = i;break;}}
  59.     return foundItem;
  60. }
  61. function imgStoreAdd(n, s, w, h) {
  62.     var i = this.find(n);
  63.     if (i == -1) {i = ++this.count;}
  64.     this.img[i] = new imgStoreItem(n, s, parseInt(w, 10), parseInt(h, 10));
  65. }
  66. function imgStoreGetSrc(theName) {
  67.     var i = this.find(theName);
  68.     var img = this.img[i];
  69.     return (i == -1) ? '' : ((img.obj) ? img.obj.src : img.src);
  70. }
  71. function imgStoreGetTag(theName, iconID, altText) {
  72.     var i = this.find(theName);
  73.     if (i < 0) {return ''}
  74.     with (this.img[i]) {
  75.         if (src == '') {return ''}
  76.         var tag = '<img src="' + src + '" width="' + w + '" height="' + h + '" border="0" align="left" hspace="0" vspace="0"';
  77.         tag += (iconID != '') ? ' name="' + iconID + '"' : '';
  78.         tag += ' alt="' + ((altText)?altText:'') + '">';
  79.     }
  80.     return tag;
  81. }
  82. // The MenuItem object.  This contains the data and functions for drawing each item.
  83. function MenuItem (owner, id, type, text, url, status, nItem, pItem, parent) {
  84.     var t = this;
  85.     this.owner = owner;
  86.     this.id = id;
  87.     this.type = type;
  88.     this.text = text;
  89.     this.url = url;
  90.     this.status = status;
  91.     this.target = owner.defaultTarget;
  92.     this.nextItem = nItem;
  93.     this.prevItem = pItem;
  94.     this.FirstChild = -1;
  95.     this.parent = parent;
  96.     this.isopen = false;
  97.     this.isSelected = false;
  98.     this.draw = MIDraw;
  99.     this.PMIconName = MIGetPMIconName;
  100.     this.docIconName = MIGetDocIconName;
  101.     this.setImg = MISetImage;
  102.     this.setIsOpen = MISetIsOpen;
  103.     this.setSelected = MISetSelected;
  104.     this.setIcon = MISetIcon;
  105.     this.mouseOver = MIMouseOver;
  106.     this.mouseOut = MIMouseOut;
  107.     var i = (this.owner.imgStore) ? this.owner.imgStore.find(type) : -2;
  108.     if (i == -1) {i = this.owner.imgStore.find('iconPlus');}
  109.     this.height = (i > -1) ? this.owner.imgStore.img[i].h : 0;
  110. }
  111. function MIDraw (indentStr) {
  112.     var o = this.owner;
  113.     var mRef = '="return ' + o.reverseRef + "." + o.name;
  114.     var tmp = mRef + '.entry[' + this.id + '].';
  115.     var MOver = ' onMouseOver' + tmp + 'mouseOver(\''
  116.     var MOut = ' onMouseOut' + tmp + 'mouseOut(\''
  117.     var iconTag = o.imgStore.getTag(this.PMIconName(), 'plusMinusIcon' + this.id, '');
  118.     var aLine = '<nobr>' + indentStr;
  119.     if (!this.noOutlineImg) {
  120.         if (this.FirstChild != -1) {
  121.             aLine += '<A HREF="#" onClick' + mRef + '.toggle(' + this.id + ');"' + MOver + 'plusMinusIcon\',this);"' + MOut + 'plusMinusIcon\');">' + iconTag + '</A>';                
  122.         } else {
  123.             aLine += iconTag;
  124.         }
  125.     }
  126.     var tip = (o.tipText == 'text') ? this.text : ((o.tipText == 'status') ? this.status : '');
  127.     var theEntry = o.imgStore.getTag(this.docIconName(), 'docIcon' + this.id, tip) + this.text;
  128.     var theImg = o.imgStore.getTag(this.docIconName(), 'docIcon' + this.id, tip);
  129.     var sTxt = '<SPAN CLASS="' + ((this.CSSClass) ? this.CSSClass : ((this.FirstChild != -1) ? 'node' : 'leaf')) + '">';
  130.     var lTxt = '<A NAME="joustEntry' + this.id + '"';
  131.     var theUrl = (((this.url == '') && theBrowser.canJSVoid && o.showAllAsLinks) || o.wizardInstalled) ? 'javascript:void(0);' : this.url;
  132.     if (theUrl != '') {
  133.         if (this.target.charAt(1) == "_") {theUrl = "javascript:" + o.reverseRef + ".loadURLInTarget('" + theUrl + "', '" + this.target + "');";}
  134.             lTxt += ' HREF="' + theUrl + '" TARGET="' + this.target + '" onClick' + mRef + '.itemClicked(' + this.id + ');"'
  135.             + MOver + 'docIcon\',this);"' + MOut + 'docIcon\');"';
  136.     }
  137.     lTxt += (tip) ? ' TITLE="' + tip + '">' : '>';
  138.     aLine += sTxt + lTxt + theImg;
  139.     if (this.multiLine) {
  140.         aLine += '</A></SPAN><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD>' + sTxt + lTxt + this.text + '</A></SPAN></TD></TR></TABLE>';
  141.     } else {
  142.         aLine += this.text + '</A></SPAN>';
  143.     }
  144.     aLine += '</nobr>';
  145.     if ((theBrowser.hasW3CDOM) && (theBrowser.hasDHTML) && (!this.multiLine))  { aLine += '<br>'; }
  146.     return aLine
  147. }
  148. function MIGetPMIconName() {
  149.     var n = 'icon' + ((this.FirstChild != -1) ? ((this.isopen == true) ? 'Minus' : 'Plus') : 'Join');
  150.     n += (this.id == this.owner.firstEntry) ? ((this.nextItem == -1) ? 'Only' : 'Top') : ((this.nextItem == -1) ? 'Bottom' : '');
  151.     return n;
  152. }
  153. function MIGetDocIconName() {
  154.     var is = this.owner.imgStore; var n = this.type;
  155.     n += ((this.isopen) && (is.getSrc(n + 'Expanded') != '')) ? 'Expanded' : '';
  156.     n += ((this.isSelected) && (is.getSrc(n + 'Selected') != '')) ? 'Selected' : '';
  157.     return n;
  158. }
  159. function MISetImage(imgID, imgName) {
  160.     var o = this.owner; var s = o.imgStore.getSrc(imgName);
  161.     if ((s != '') && (theBrowser.canCache) && (!o.amBusy)) {
  162.         var img = (theBrowser.hasDHTML) ? getDHTMLImg(o.container + '.document', 'entryDIV' + this.id, imgID) : eval(o.container).document.images[imgID];
  163.         if (img && img.src != s) {img.src = s;} 
  164.     }
  165. }
  166. function MISetIsOpen (isOpen) {
  167.     if ((this.isopen != isOpen) && (this.FirstChild != -1)) {
  168.         this.isopen = isOpen;
  169.         this.setImg('plusMinusIcon' + this.id, this.PMIconName());
  170.         this.setImg('docIcon' + this.id, this.docIconName());
  171.         return true;
  172.     } else {
  173.         return false;
  174.     }
  175. }
  176. function MISetSelected (isSelected) {
  177.     this.isSelected = isSelected;
  178.     this.setImg('docIcon' + this.id, this.docIconName());
  179.     if ((this.parent >= 0) && this.owner.selectParents) {this.owner.entry[this.parent].setSelected(isSelected);}
  180. }
  181. function MISetIcon (newType) {
  182.     this.type = newType;
  183.     this.setImg('docIcon' + this.id, this.docIconName());
  184. }
  185. function MIMouseOver(imgName, theURL) {
  186.     eval(this.owner.container).status = '';  //Needed for setStatus to work on MSIE 3 - Go figure!?
  187.     var newImg = '';
  188.     var s = '';
  189.     if (imgName == 'plusMinusIcon') {
  190.         newImg = this.PMIconName();
  191.         s = 'Click to ' + ((this.isopen == true) ? 'collapse.' : 'expand.');
  192.     } else {
  193.         if (imgName == 'docIcon') {
  194.             newImg = this.docIconName();
  195.             s = (this.status != null) ? this.status : theURL;
  196.         }
  197.     }
  198.     setStatus(s);
  199.     if (theBrowser.canOnMouseOut) {this.setImg(imgName + this.id, newImg + 'MouseOver');}
  200.     if(this.onMouseOver) {var me=this;eval(me.onMouseOver);}
  201.     return true;
  202. }
  203. function MIMouseOut(imgName) {
  204.     clearStatus();
  205.     var newImg = '';
  206.     if (imgName == 'plusMinusIcon') {
  207.         newImg = this.PMIconName();
  208.     } else {
  209.         if (imgName == 'docIcon') {newImg = this.docIconName();}
  210.     }
  211.     this.setImg(imgName + this.id, newImg);
  212.     if(this.onMouseOut) {var me=this;eval(me.onMouseOut);}
  213.     return true;
  214. }
  215. // The Menu object.  This is basically an array object although the data in it is a tree.
  216. function Menu () {
  217.     this.count = -1;
  218.     this.version = '2.5.4';
  219.     this.firstEntry = -1;
  220.     this.autoScrolling = false;
  221.     this.modalFolders = false;
  222.     this.linkOnExpand = false;
  223.     this.toggleOnLink = false;
  224.     this.showAllAsLinks = false;
  225.     this.savePage = true;
  226.     this.name = 'theMenu';
  227.     this.container = 'menu';
  228.     this.reverseRef = 'parent';
  229.     this.contentFrame = 'text';
  230.     this.defaultTarget = 'text';
  231.     this.tipText = 'none';
  232.     this.selectParents = false;
  233.     this.lastPMClicked = -1;
  234.     this.selectedEntry = -1;
  235.     this.wizardInstalled = false;
  236.     this.amBusy = true;
  237.     this.maxHeight = 0;
  238.     this.imgStore = new imgStoreObject;
  239.     this.entry = new MenuItem(this, 0, '', '', '', '', -1, -1, -1);
  240.     this.contentWin = MenuGetContentWin;
  241.     this.getEmptyEntry = MenuGetEmptyEntry;
  242.     this.addEntry = MenuAddEntry;
  243.     this.addMenu = MenuAddEntry;
  244.     this.addChild = MenuAddChild;
  245.     this.rmvEntry = MenuRmvEntry;
  246.     this.rmvChildren = MenuRmvChildren;
  247.     this.draw = MenuDraw;
  248.     this.drawALevel = MenuDrawALevel;
  249.     this.refresh = MenuRefresh;
  250.     this.reload = MenuReload;
  251.     this.refreshDHTML = MenuRefreshDHTML;
  252.     this.scrollTo = MenuScrollTo;
  253.     this.itemClicked = MenuItemClicked;
  254.     this.selectEntry = MenuSelectEntry;
  255.     this.setEntry = MenuSetEntry;
  256.     this.setEntryByURL = MenuSetEntryByURL;
  257.     this.setAllChildren = MenuSetAllChildren;
  258.     this.setAll = MenuSetAll;
  259.     this.openAll = MenuOpenAll;
  260.     this.closeAll = MenuCloseAll;
  261.     this.findEntry = MenuFindEntry;
  262.     this.toggle = MenuToggle;
  263. }
  264. function MenuGetContentWin() {
  265.     return eval(((myOpener != null) ? 'myOpener.' : 'self.') + this.contentFrame);
  266. }
  267. function MenuGetEmptyEntry() {
  268.     for (var i = 0; i <= this.count; i++) {if (this.entry[i] == null) {break;}}
  269.     if (i > this.count) {this.count = i};
  270.     return i
  271. }
  272. function MenuAddEntry (addTo, type, text, url, status, insert) {
  273.     if (!insert) {insert=false;}
  274.     var theNI = -1;var theP = -1;var thePI = -1;
  275.     if (addTo < 0) {
  276.         var i = addTo = this.firstEntry;
  277.         if (!insert) {while (i > -1) {addTo = i;i = this.entry[i].nextItem;}}
  278.     }
  279.     if (addTo >= 0) {
  280.         var e = this.entry[addTo];
  281.         if (!e) {return -1;}
  282.         thePI = (insert)?e.prevItem:addTo;
  283.         theNI = (insert)?addTo:e.nextItem;
  284.         theP = e.parent;
  285.     }
  286.     var eNum = this.getEmptyEntry();
  287.     if (thePI >= 0) {
  288.         this.entry[thePI].nextItem = eNum;
  289.     } else {
  290.         if (theP >= 0) {
  291.             this.entry[theP].FirstChild = eNum;
  292.         } else {
  293.             this.firstEntry = eNum;
  294.         }
  295.     }
  296.     if (theNI >= 0) {this.entry[theNI].prevItem = eNum;}
  297.     this.entry[eNum] = new MenuItem(this, eNum, type, text, url, status, theNI, thePI, theP);
  298.     return eNum;
  299. }
  300. function MenuAddChild (addTo, type, text, url, status, insert) {
  301.     if (!insert) {insert=false;}
  302.     var eNum = -1;
  303.     if ((this.count == -1) || (addTo < 0)) {
  304.         eNum = this.addEntry(-1, type, text, url, status, false);
  305.     } else {
  306.         var e = this.entry[addTo];
  307.         if (!e) {return -1;}
  308.         var cID = e.FirstChild;
  309.         if (cID < 0) {
  310.             e.FirstChild = eNum = this.getEmptyEntry();
  311.             this.entry[eNum] = new MenuItem(this, eNum, type, text, url, status, -1, -1, addTo);    
  312.         } else {
  313.             while (!insert && (this.entry[cID].nextItem >= 0)) {cID = this.entry[cID].nextItem;}
  314.             eNum = this.addEntry(cID, type, text, url, status, insert);
  315.         }
  316.     }
  317.     return eNum;
  318. }
  319. function MenuRmvEntry (theEntry) {
  320.     var e = this.entry[theEntry];
  321.     if (e == null) {return;}
  322.     var p = e.prevItem;
  323.     var n = e.nextItem;
  324.     if (e.FirstChild > -1) {this.rmvChildren(theEntry);}
  325.     if (this.firstEntry == theEntry) {this.firstEntry = n}
  326.     if (this.selectedEntry == theEntry) {this.selectedEntry = n}
  327.     if (p > -1) {
  328.         this.entry[p].nextItem = n;
  329.     } else { 
  330.         if (e.parent > -1) {
  331.             this.entry[e.parent].FirstChild = n;
  332.         } else {
  333.             if (this.firstEntry == theEntry) {this.firstEntry = n}
  334.         }
  335.     } 
  336.     if (n > -1) {this.entry[n].prevItem = p;}
  337.     this.entry[theEntry] = null;
  338. }
  339. function MenuRmvChildren (theP) {
  340.     var eNum;var e;var tmp;
  341.     if (theP == -1) {
  342.         eNum = this.firstEntry;
  343.         this.firstEntry = -1;
  344.     } else {
  345.         eNum = this.entry[theP].FirstChild;
  346.         this.entry[theP].FirstChild = -1;
  347.     }
  348.     while (eNum > -1) {
  349.         e = this.entry[eNum];
  350.         if (e.FirstChild > -1) {this.rmvChildren(eNum);}
  351.         if (this.selectedEntry == eNum) {this.selectedEntry = e.parent;}
  352.         tmp = eNum;
  353.         eNum = e.nextItem;
  354.         this.entry[tmp] = null;
  355.     }
  356. }
  357. function MenuDraw() {
  358.     this.maxHeight = 0;
  359.     var theDoc = eval(this.container + ".document");
  360.     eval(this.container).document.writeln(this.drawALevel(this.firstEntry, '', true, theDoc));
  361.     if (theBrowser.hasDHTML) {
  362.         for (var i = 0; i <= this.count; i++) {
  363.             if (this.entry[i]) {
  364.                 this.maxHeight += getDHTMLObjHeight(this.container + '.document', 'entryDIV' + i);
  365.             }
  366.         }
  367.     } else {
  368.         if ((this.lastPMClicked > 0) && theBrowser.mustMoveAfterLoad && this.autoScrolling) {
  369.             this.scrollTo(this.lastPMClicked);
  370.         }
  371.     }
  372. }
  373. function MenuDrawALevel(firstItem, indentStr, isVisible, theDoc) {
  374.     var currEntry = firstItem;
  375.     var padImg = "";
  376.     var aLine = "";
  377.     var theLevel = "";
  378.     var e = null;
  379.     while (currEntry > -1) {
  380.         e = this.entry[currEntry];
  381.         aLine = e.draw(indentStr);
  382.         if (theBrowser.hasDHTML) {
  383.             aLine = '<DIV ID="entryDIV' + currEntry + '" CLASS="menuItem">' + aLine + '</DIV>';
  384.         } else {
  385.             aLine += '<BR CLEAR="ALL">';
  386.         }
  387.         theBrowser.lineByLine = true;
  388.         if (theBrowser.lineByLine) {theDoc.writeln(aLine);} else {theLevel += aLine;}
  389.         if ((e.FirstChild > -1) && ((theBrowser.hasDHTML || (e.isopen && isVisible)))) {
  390.             padImg = (e.noOutlineImg) ? '' : this.imgStore.getTag((e.nextItem == -1) ? 'iconBlank' : 'iconLine', '', '');
  391.             theLevel += this.drawALevel(e.FirstChild, indentStr + padImg, (e.isopen && isVisible), theDoc);
  392.         }
  393.         currEntry = e.nextItem;
  394.     }
  395.     return theLevel;
  396. }
  397. function MenuRefresh() {
  398.     if (theBrowser.hasDHTML) {
  399.         if (!this.amBusy) {
  400.             this.refreshDHTML();
  401.             if (this.autoScrolling) {this.scrollTo(this.lastPMClicked);}
  402.         }
  403.     } else {
  404.         this.reload();
  405.     }
  406. }
  407. function MenuReload() {
  408.     if (!this.amBusy) {
  409.         this.amBusy = true;
  410.         var l = eval(this.container).location;
  411.         var rm = theBrowser.reloadMethod;
  412.         var newLoc = fixPath(l.pathname);
  413.         var s = '';
  414.         if (l.search) {s = l.search;}
  415.         if (theBrowser.needsMenuSearch) {
  416.             if (s == '') {
  417.                 s = '?jtoggle=1';
  418.             } else {
  419.                 var p = s.indexOf('jtoggle=');
  420.                 if (p < 0) {
  421.                     s += '&jtoggle=1';
  422.                 } else {
  423.                     var t = (s.substring(p + 8, p + 9) == "1") ? "2" : "1";
  424.                     s = s.substring(0, p+8) + t;
  425.                 }
  426.             }
  427.         }
  428.         newLoc += s;
  429.         if (this.autoScrolling && (this.lastPMClicked > 0) && !theBrowser.mustMoveAfterLoad) {
  430.             newLoc += "#joustEntry" + this.lastPMClicked;
  431.         }
  432.         if (rm == 'replace') {
  433.             l.replace(newLoc);
  434.         } else {
  435.             if (rm == 'reload') {
  436.                 l.reload();
  437.             } else {
  438.                 if (rm == 'timeout') {
  439.                     setTimeout(this.container + ".location.href ='" + newLoc + "';", 100);
  440.                 } else {
  441.                     l.href = newLoc;
  442.                 }
  443.             }
  444.         }
  445.     }
  446. }
  447. function MenuRefreshDHTML() {
  448.     var nextItemArray = new simpleArray;
  449.     var currEntry = this.firstEntry;
  450.     var level = (currEntry == -1) ? 0 : 1;
  451.     var isVisible = true;
  452.     var lastVisibleLevel = 1;
  453.     var co = eval(this.container);
  454.     var yPos = co.menuStart;
  455.     var d = this.container + '.document';
  456.     var e = null;var s = null;
  457.     while (level > 0) {
  458.         e = this.entry[currEntry];
  459.         s = getDHTMLObj(d, 'entryDIV' + currEntry);
  460.         if (isVisible) {
  461.             s.top = yPos;
  462.             s.visibility = 'visible';
  463.             yPos += getDHTMLObjHeight(d, 'entryDIV' + currEntry);
  464.             lastVisibleLevel = level;
  465.         } else {
  466.             s.visibility = 'hidden';
  467.             s.top = 0;
  468.         }
  469.         if (e.FirstChild > -1) {
  470.             isVisible = (e.isopen == true) && isVisible;
  471.             nextItemArray[level++] = e.nextItem;
  472.             currEntry = e.FirstChild;
  473.         } else {
  474.             if (e.nextItem != -1) {
  475.                 currEntry = e.nextItem;
  476.             } else {
  477.                 while (level > 0) {
  478.                     if (nextItemArray[--level] != -1) {
  479.                         currEntry = nextItemArray[level];
  480.                         isVisible = (lastVisibleLevel >= level);
  481.                         break;
  482.                     }
  483.                 }
  484.             }
  485.         }
  486.     }
  487.     this.maxHeight = yPos;
  488.     co.setMenuHeight(yPos);
  489. }
  490. function MenuScrollTo(entryNo) {
  491.     if (theBrowser.hasDHTML) {
  492.         var e = this.entry[entryNo];
  493.         if (!e) {return;}
  494.         var co = eval(this.container);
  495.         var d = this.container + '.document';
  496.         var srTop = getDHTMLObjTop(getDHTMLObj(d, 'entryDIV' + entryNo));
  497.         var srBot = (e.nextItem > 0) ? getDHTMLObjTop(getDHTMLObj(d, 'entryDIV' + e.nextItem)) : this.maxHeight;
  498.         if (theBrowser.code == 'MSIE') {
  499.             var curTop = co.document.body.scrollTop;
  500.             var curBot = curTop + co.document.body.clientHeight;
  501.         } else {
  502.             var curTop = co.pageYOffset;
  503.             var curBot = curTop + co.innerHeight;
  504.         }
  505.         if ((srBot > curBot) || (srTop < curTop)) {
  506.             var scrBy = srBot - curBot;
  507.             if (srTop < (curTop + scrBy)) {scrBy = srTop - curTop;}
  508.             co.setTimeout('self.scrollBy(0, ' + scrBy + ');', 100);
  509.         }
  510.     } else {
  511.         var l = fixPath(eval(this.container).location.pathname) + '#joustEntry' + entryNo;
  512.         setTimeout(this.container + '.location.href = "' + l + '";', 100);
  513.     }
  514. }
  515. function MenuItemClicked(entryNo, fromToggle) {
  516.     var r = true;
  517.     var e = this.entry[entryNo];
  518.     var w = this.contentWin();
  519.     var b = theBrowser;
  520.  
  521.     this.selectEntry(entryNo);
  522.     if (this.wizardInstalled) {w.menuItemClicked(entryNo);}
  523.     if(e.onClickFunc) {e.onClick = e.onClickFunc;}
  524.     if(e.onClick) {var me=e;if(eval(e.onClick) == false) {r = false;}}
  525.     if (r) {
  526.         if (((this.toggleOnLink) && (e.FirstChild != -1) && !(fromToggle)) || e.noOutlineImg) {
  527.             if (b.hasDHTML) {
  528.                 this.toggle(entryNo, true);
  529.             } else {
  530.                 setTimeout(this.name + '.toggle(' + entryNo + ', true);', 100);
  531.             }
  532.         }
  533.     }
  534.     return (e.url != '') ? r : false;
  535. }
  536. function MenuSelectEntry(entryNo) {
  537.     var oe = this.entry[this.selectedEntry];
  538.     if (oe) {oe.setSelected(false);}
  539.     var e = this.entry[entryNo];
  540.     if (e) {e.setSelected(true);}
  541.     this.selectedEntry = entryNo;
  542. }
  543. function MenuSetEntry(entryNo, state) {
  544.     var cl = ',' + entryNo + ',';
  545.     var e = this.entry[entryNo];
  546.     this.lastPMClicked = entryNo;
  547.     var mc = e.setIsOpen(state);
  548.     var p = e.parent;
  549.     while (p >= 0) {
  550.         cl += p + ',';
  551.         e = this.entry[p];
  552.         mc |= (e.setIsOpen(true));
  553.         p = e.parent;
  554.     }
  555.     if (this.modalFolders) {
  556.         for (var i = 0; i <= this.count; i++) {
  557.             e = this.entry[i];
  558.             if ((cl.indexOf(',' + i + ',') < 0) && e) {mc |= e.setIsOpen(false);}
  559.         }
  560.     }
  561.     return mc;
  562. }
  563. function MenuSetEntryByURL(theURL, state) {
  564.     var i = this.findEntry(theURL, 'url', 'right', 0);
  565.     return (i != -1) ? this.setEntry(i, state) : false;
  566. }
  567. function MenuSetAllChildren(state, parentID) {
  568.     var hasChanged = false;
  569.     var currEntry = (parentID > -1) ? this.entry[parentID].FirstChild : this.firstEntry;
  570.     while (currEntry > -1) {
  571.         var e = this.entry[currEntry];
  572.         hasChanged |= e.setIsOpen(state);
  573.         if (e.FirstChild > -1) {hasChanged |= this.setAllChildren(state, currEntry);}
  574.         currEntry = e.nextItem;
  575.     }
  576.     return hasChanged;
  577. }
  578. function MenuSetAll(state, parentID) {
  579.     if (theBrowser.version >= 4) {
  580.         if (parentID == 'undefined') {parentID = -1;}
  581.     } else {
  582.         if (parentID == null) {parentID = -1;}
  583.     }
  584.     var hasChanged = false;
  585.     if (parentID > -1) {hasChanged |= this.entry[parentID].setIsOpen(state);}
  586.     hasChanged |= this.setAllChildren(state, parentID);
  587.     if (hasChanged) {
  588.         this.lastPMClicked = this.firstEntry;
  589.         this.refresh();
  590.     }
  591. }
  592. function MenuOpenAll() {this.setAll(true, -1);}
  593. function MenuCloseAll() {this.setAll(false, -1)}
  594. function MenuFindEntry(srchVal, srchProp, matchType, start) {
  595.     var e;
  596.     var sf;
  597.     if (srchVal == "") {return -1;}
  598.     if (!srchProp) {srchProp = "url";}
  599.     if (!matchType) {matchType = "exact";}
  600.     if (!start) {start = 0;}
  601.     if (srchProp == "URL") {srchProp = "url";}
  602.     if (srchProp == "title") {srchProp = "text";}
  603.     eval("sf = cmp_" + matchType);
  604.     for (var i = start; i <= this.count; i++) {
  605.         if (this.entry[i]) {
  606.             e = this.entry[i];
  607.             if (sf(eval("e." + srchProp), srchVal)) {return i;}
  608.         }        
  609.     }
  610.     return -1;
  611. }
  612. function cmp_exact(c, s) {return (c == s);}
  613. function cmp_left(c, s) {
  614.     var l = Math.min(c.length, s.length);
  615.     return ((c.substring(1, l) == s.substring(1, l)) && (c != ""));
  616. }
  617. function cmp_right(c, s) {
  618.     var l = Math.min(c.length, s.length);
  619.     return ((c.substring(c.length-l) == s.substring(s.length-l)) && (c != ""));
  620. }
  621. function cmp_contains(c, s) {return (c.indexOf(s) >= 0);}
  622. function MenuToggle(entryNo, fromClicked) {
  623.     var r = true;
  624.     var e = this.entry[entryNo];
  625.     if (e.onToggle) {var me=e;if(eval(e.onToggle) == false) {r = false;}}
  626.     if (r) {
  627.         var chg = this.setEntry(entryNo, e.isopen ^ 1);
  628.         if (this.linkOnExpand && e.isopen) {
  629.             if (e.url != '') {loadURLInTarget(e.url, e.target);}
  630.             if (!fromClicked) {this.itemClicked(entryNo, true);}
  631.         }
  632.         if (chg) {this.refresh();}
  633.     }
  634.     return false;
  635. }
  636. // Other functions
  637. function DrawMenu(m) {
  638.     m.draw();
  639. }
  640. function browserInfo() {
  641.     this.code = 'unknown';
  642.     this.version = 0;
  643.     this.platform = 'Win';
  644.     var ua = navigator.userAgent;
  645.     var i = ua.indexOf('WebTV');
  646.     if (i >= 0) {
  647.         this.code = 'WebTV';
  648.         i += 6;
  649.     } else {
  650.         i = ua.indexOf('Opera');
  651.         if (i >= 0) {
  652.             this.code = 'OP';
  653.             i = ua.indexOf(') ') + 2;
  654.         } else {
  655.             i = ua.indexOf('MSIE');
  656.             if (i >= 0) {
  657.                 this.code = 'MSIE';
  658.                 i += 5;
  659.             } else {
  660.                 i = ua.indexOf('Mozilla/');
  661.                 if (i >= 0) {
  662.                     this.code = 'NS';
  663.                     i += 8;
  664.                 }
  665.             }
  666.         }
  667.     }
  668.     this.version = parseFloat(ua.substring(i, i+4));
  669.     if (ua.indexOf('Mac') >= 0) {this.platform = 'Mac';}
  670.     if (ua.indexOf('OS/2') >= 0) {this.platform = 'OS/2';}
  671.     if (ua.indexOf('X11') >= 0) {this.platform = 'UNIX';}
  672.     var v = this.version;
  673.     var p = this.platform;
  674.     var NS = (this.code == 'NS');
  675.     var IE = (this.code == 'MSIE');
  676.     var WTV = (this.code == 'WebTV');
  677.     var OP = (this.code == 'OP');
  678.     var OP32up = (OP && (v >= 3.2));
  679.     var OP5up = (OP && (v >= 5));
  680.     var IE4up = (IE && (v >= 4));
  681.     var NS3up = (NS && (v >= 3));
  682.     var NS6up = (NS && (v >= 5));
  683.     this.canCache = NS3up || IE4up || OP32up || WTV;
  684.     this.canOnMouseOut = this.canCache;
  685.     this.canOnError = NS3up || IE4up || OP32up;
  686.     this.canJSVoid = !((NS && !NS3up) || (IE && !IE4up) || (OP && (v < 3.5)));
  687.     this.lineByLine = (v < 4);
  688.     this.mustMoveAfterLoad = NS3up || (IE4up && (p != 'Mac')) || WTV;
  689.     if (NS6up == true) {
  690.         this.reloadMethod = 'reload';
  691.     } else {
  692.         if (NS3up || IE4up || WTV || OP5up) {
  693.             this.reloadMethod = 'replace';
  694.         } else {
  695.             this.reloadMethod = (NS && (v == 2.01) && (p != 'Win')) ? 'timeout' : 'href';
  696.         }
  697.     }
  698.     this.needsMenuSearch = (OP && !OP5up);
  699.     this.canFloat = NS || (IE && !((p == 'Mac') && (v >= 4) && (v < 5)));
  700.     this.hasDHTML = ((NS || IE) && (v >= 4)) && !(IE && (p == 'Mac') && (v < 4.5));
  701.     this.slowDHTML = IE4up || NS6up;
  702.     this.hasW3CDOM = (document.getElementById) ? true : false;
  703.     this.needLM = (!this.hasW3CDOM && NS) || (IE && (p == 'Mac') && (v >= 4.5));
  704.     this.DHTMLRange = IE ? '.all' : '';
  705.     this.DHTMLStyleObj = IE ? '.style' : '';
  706.     this.DHTMLDivHeight = IE ? '.offsetHeight' : '.clip.height';
  707. }
  708. function getWindow() {return (floatingMode) ? myOpener : self;}
  709. function setStatus(theText) {
  710.     var theWindow = getWindow();
  711.     if (theWindow) {
  712.         theWindow.status = theText;
  713.         if (!theBrowser.canOnMouseOut) {
  714.             clearTimeout(statusTimeout);
  715.             statusTimeout = setTimeout('clearStatus()', 5000);
  716.         }
  717.     }
  718.     return true;
  719. }
  720. function clearStatus() {
  721.     var theWindow = getWindow();
  722.     if (theWindow) {theWindow.status = '';}
  723. }
  724. function unloadFloating() {
  725.     if (myOpener) {
  726.         if (myOpener.JoustFrameset) {myOpener.setTimeout('menuClosed();', 100);}
  727.     }
  728. }
  729. function getMode() {
  730.     var theMode = getParm(document.cookie, 'mode', ';');
  731.     return ((theMode == "Floating") || (theMode == "NoFrames")) ? theMode : "Frames";
  732. }
  733. function smOnError (msg, url, lno) {
  734.     smCallerWin.onerror = oldErrorHandler;
  735.     if (confirm(smSecurityMsg)) {setTimeout('setMode("' + smNewMode + '");', 100);}
  736.     return true;
  737. }
  738. function smSetCookie(theMode) {
  739.     document.cookie = 'mode=' + theMode + '; path=/';
  740.     if (getMode() != theMode) {
  741.         alert(smCookieMsg);
  742.         return false;
  743.     } else {
  744.         return true;
  745.     }
  746. }
  747. function setMode(theMode, callerWin) {
  748.     smNewMode = theMode
  749.     smCallerWin = (theBrowser.code == 'NS') ? callerWin : self;
  750.     var okToGo = true;
  751.     var currentMode = getMode();
  752.     if (theMode != currentMode) {
  753.         if (currentMode == 'Floating') {
  754.             if (smSetCookie(theMode)) {self.close();}
  755.         } else {
  756.             var dest = '';
  757.             if (theBrowser.canFloat) {
  758.                 if ((theMenu.savePage) && (callerWin)) {
  759.                     if (theBrowser.canOnError) {
  760.                         oldErrorHandler = smCallerWin.onerror;
  761.                         smCallerWin.onerror = smOnError;
  762.                     }
  763.                     var l = theMenu.contentWin().location;
  764.                     var p = l.pathname;
  765.                     if (theBrowser.canOnError) {smCallerWin.onerror = oldErrorHandler;}
  766.                     if (p) {
  767.                         dest = fixPath(p) + l.search;
  768.                     } else {
  769.                         if (!confirm(smSecurityMsg)) {okToGo = false;}
  770.                     }
  771.                 }
  772.             } else {
  773.                 okToGo = false;
  774.             }
  775.             if (okToGo && smSetCookie(theMode)) {
  776.                 if (theMode == 'NoFrames') {
  777.                     location.href = (index3 == '') ? ((dest == '') ? '/' : dest) : index3;
  778.                 } else {
  779.                     location.href = index2 + ((dest == '') ? '' : '?page=' + escape(dest));
  780.                 }
  781.             }
  782.         }
  783.     }
  784. }
  785. function fixPath(p) {
  786.     var i = p.indexOf('?', 0);
  787.     if (i >= 0) {p = p.substring(0,i);}
  788.     if (p.substring(0,2) == '/:') {p = p.substring(p.indexOf('/', 2), p.length);}
  789.     i = p.indexOf('\\', 0);
  790.     while (i >= 0) {
  791.         p = p.substring(0,i) + '/' + p.substring(i+1,p.length);
  792.         i = p.indexOf('\\', i);
  793.     }
  794.     return p;
  795. }
  796. function fileFromPath(p) {
  797.     p = fixPath(p);
  798.     var i = p.lastIndexOf('\\');
  799.     if (i >= 0) {p = p.substring(i+1,p.length);}
  800.     return p;
  801. }
  802. function getParm(theStr, parm, delim) {
  803.     // returns value of parm from string
  804.     if (theStr.length == 0) {return '';}
  805.     var sPos = theStr.indexOf(parm + "=");
  806.     if (sPos == -1) {return '';}
  807.     sPos = sPos + parm.length + 1;
  808.     var ePos = theStr.indexOf(delim, sPos);
  809.     if (ePos == -1) {ePos = theStr.length;}
  810.     return unescape(theStr.substring(sPos, ePos));
  811. }
  812. function pageFromSearch(def, m, selIt) {
  813.     var s = self.location.search;
  814.     if ((s == null) || (s.length <= 1)) {return def;}
  815.     var p = getParm(s, 'page', '&');
  816.     p = (p != '') ? fixPath(p) : def;
  817.     if (m != null) {
  818.         var e = m.findEntry(p, 'URL', 'exact');
  819.         if ((e != -1) && selIt) {
  820.             m.setEntry(e, true);
  821.             m.selectEntry(e);
  822.         }
  823.     }
  824.     return p;
  825. }
  826. function loadURLInTarget(u, t) {
  827.     var w = eval("self." + t);
  828.     if (!w && myOpener) {w = eval("myOpener." + t);}
  829.     if (!w && ("_top,_parent,_self".indexOf(t) >= 0)) {
  830.         w = eval("getWindow()." + t.substring(1));}
  831.     if (w) {w.location.href = u;} else {window.open(u, t);}
  832. }
  833. function defOnError(msg, url, lno) {
  834.     if (jsErrorMsg == '') {
  835.         return false;
  836.     } else {
  837.         alert(jsErrorMsg + '.\n\nError: ' + msg + '\nPage: ' + url + '\nLine: ' + lno + '\nBrowser: ' + navigator.userAgent);
  838.         return true;
  839.     }
  840. }
  841. function defaultResizeHandler() {
  842.     if ((theBrowser.code == "NS") && theBrowser.hasDHTML && (self.frames.length != 0)) {
  843.         if (!eval(theMenu.container + ".document.menuBottom")) {
  844.             theMenu.reload();
  845.         }
  846.     }
  847. }
  848. // Declare global variables
  849. var theBrowser = new browserInfo;
  850.  
  851. var jsErrorMsg = 'A JavaScript error has occurred on this page!  Please note down the ';
  852. jsErrorMsg += 'following information and pass it on to the Webmaster.';
  853. if (theBrowser.canOnError) {self.onerror = defOnError;}
  854.  
  855. var theMenu = new Menu;
  856. var JoustFrameset = true;
  857. var statusTimeout = 0;
  858. var index1 = 'index.htm';
  859. var index2 = 'index2.htm';
  860. var index3 = 'index3.htm';
  861. var smCallerWin;
  862. var smNewMode;
  863. var oldErrorHandler;
  864. var smNoFloat = 'Sorry, your browser does not support this feature!';
  865. var smCookieMsg = 'You must have Cookies enabled to change the display mode!';
  866. var smSecurityMsg = 'Due to security restrictions imposed by your browser, I cannot ';
  867. smSecurityMsg += 'change modes while a page from another server is being displayed. ';
  868. smSecurityMsg += 'The default home page for this site will be displayed instead.';
  869.  
  870. var floatingMode = (getMode() == 'Floating');
  871. var myOpener = null;
  872. if (floatingMode == true) {
  873.     if (self.opener) {
  874.         myOpener = self.opener;
  875.         if (myOpener.JoustFrameset) {myOpener.setTimeout('setGlobals();', 100);}
  876.     } else {
  877.         document.cookie = 'mode=Frames; path=/';
  878.         floatingMode = false;
  879.     }
  880. } else {
  881.     if (getMode() != 'Frames') {document.cookie = 'mode=Frames; path=/';}
  882. }
  883.  
  884. //    ############################   End of Joust   ############################
  885.  
  886. function initOutlineIcons(imgStore) {
  887.     var ip = 'images/menu/';
  888.     ip += (theBrowser.platform == 'Mac') ? 'mac/' : ((theBrowser.platform == 'OS/2') ? 'os2/' : 'win/');
  889.     
  890.     imgStore.add('iconPlusTop', ip + 'plustop.gif', 18, 16);
  891.     imgStore.add('iconPlus', ip + 'plus.gif', 18, 16);
  892.     imgStore.add('iconPlusBottom', ip + 'plusbottom.gif', 18, 16);
  893.     imgStore.add('iconPlusOnly', ip + 'plusonly.gif', 18, 16);
  894.     imgStore.add('iconMinusTop', ip + 'minustop.gif', 18, 16);
  895.     imgStore.add('iconMinus', ip + 'minus.gif', 18, 16);
  896.     imgStore.add('iconMinusBottom', ip + 'minusbottom.gif', 18, 16);
  897.     imgStore.add('iconMinusOnly', ip + 'minusonly.gif', 18, 16);
  898.     imgStore.add('iconLine', ip + 'line.gif', 18, 16);
  899.     imgStore.add('iconBlank', ip + 'blank.gif', 18, 16);
  900.     imgStore.add('iconJoinTop', ip + 'jointop.gif', 18, 16);
  901.     imgStore.add('iconJoin', ip + 'join.gif', 18, 16);
  902.     imgStore.add('iconJoinBottom', ip + 'joinbottom.gif', 18, 16);
  903.  
  904.     //Add folder and document images to the imgStore.
  905.     imgStore.add('Folder', ip + 'folderclosed.gif', 18, 16);
  906.     imgStore.add('FolderExpanded', ip + 'folderopen.gif', 18, 16);
  907.     imgStore.add('FolderSelected', ip + 'foldercloseds.gif', 18, 16);
  908.     imgStore.add('FolderExpandedSelected', ip + 'folderopens.gif', 18, 16);
  909.     
  910.     var di = 'images/menu/';
  911.     if ((theBrowser.code == 'NS') || (theBrowser.code == 'MSIE')) {
  912.         di += theBrowser.code.toLowerCase() + '_doc';
  913.         imgStore.add('Document', di + '.gif', 18, 16);
  914.         imgStore.add('DocumentMouseOver', di + '_mo.gif', 18, 16);
  915.         imgStore.add('DocumentSelected', di + '_sel.gif', 18, 16);
  916.     } else {
  917.         imgStore.add('Document', di + 'doc.gif', 18, 16);
  918.         imgStore.add('DocumentMouseOver', di + 'doc_mo.gif', 18, 16);
  919.         imgStore.add('DocumentSelected', di + 'doc_sel.gif', 18, 16);
  920.     }
  921. }
  922. function initialise() {
  923.     // Tell joust where to find the various index files it needs
  924.     index1 = 'index.htm';
  925.     index2 = 'index2.htm';
  926.     index3 = 'index3.htm';
  927.     
  928.     // Set up parameters to control menu behaviour
  929.     theMenu.autoScrolling = true;    
  930.     theMenu.modalFolders = false;
  931.     theMenu.linkOnExpand = false;
  932.     theMenu.toggleOnLink = false;
  933.     theMenu.showAllAsLinks = false;
  934.     theMenu.savePage = true;
  935.     theMenu.tipText = "status";
  936.     theMenu.selectParents = false;
  937.     theMenu.name = "theMenu";
  938.     theMenu.container = "self.menu";
  939.     theMenu.reverseRef = "parent";
  940.     theMenu.contentFrame = "text";
  941.     theMenu.defaultTarget = "text";
  942.     
  943.     // Initialise all the icons
  944.     initOutlineIcons(theMenu.imgStore);
  945.     
  946.     // Now set up the menu with a whole lot of addEntry and addChild function calls
  947.